GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 661d6f...983953 )
by Jesus
16s queued 10s
created

admins.js ➔ ... ➔ hex   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
eloc 2
nc 1
nop 1
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
$(document).on('turbolinks:load', function(){
18
  var controller = $("body").data('controller');
19
  var action = $("body").data('action');
20
21
  // Only run on the admins page.
22
  if (controller == "admins" && action == "index") {
23
    // show the modal with the correct form action url
24
    $(".delete-user").click(function(data){
25
      var uid = $(data.target).closest("tr").data("user-uid")
26
      var url = $("body").data("relative-root")
27
      if (!url.endsWith("/")) {
28
        url += "/"
29
      }
30
      url += "u/" + uid
31
      $("#delete-confirm").parent().attr("action", url)
32
    })
33
34
    //clear the role filter if user clicks on the x
35
    $(".clear-role").click(function(data) {
0 ignored issues
show
Unused Code introduced by
The parameter data is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
36
      search = new URL(location.href).searchParams.get('search')
0 ignored issues
show
Bug introduced by
The variable search seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.search.
Loading history...
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
37
38
      url = window.location.pathname + "?page=1"
0 ignored issues
show
Bug introduced by
The variable url seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.url.
Loading history...
39
    
40
      if (search) {
41
        url += "&search=" + search
42
      }  
43
    
44
      window.location.replace(url);
45
    })
46
    
47
    /* COLOR SELECTORS */
48
    
49
    $('#colorinput-regular').ColorPicker({
50
      onBeforeShow: function () {
51
        var colour = rgb2hex($("#colorinput-regular").css("background-color"))
52
53
        $(this).ColorPickerSetColor(colour);
54
      },
55
      onSubmit: function(_hsb, hex, _rgb, _el) {
0 ignored issues
show
Unused Code introduced by
The parameter _rgb is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter _el is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
56
        $.post($("#coloring-path-regular").val(), {color: '#' + hex}).done(function(data) {
0 ignored issues
show
Unused Code introduced by
The parameter data is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
57
          location.reload()
58
        });
59
      },
60
    });
61
62
    $('#colorinput-lighten').ColorPicker({
63
      onBeforeShow: function () {
64
        var colour = rgb2hex($("#colorinput-lighten").css("background-color"))
65
66
        $(this).ColorPickerSetColor(colour);
67
      },
68
      onSubmit: function(_hsb, hex, _rgb, _el) {
0 ignored issues
show
Unused Code introduced by
The parameter _el is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter _rgb is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
69
        $.post($("#coloring-path-lighten").val(), {color: '#' + hex}).done(function(data) {
0 ignored issues
show
Unused Code introduced by
The parameter data is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
70
          location.reload()
71
        });
72
      },
73
    });
74
75
    $('#colorinput-darken').ColorPicker({
76
      onBeforeShow: function () {
77
        var colour = rgb2hex($("#colorinput-darken").css("background-color"))
78
79
        $(this).ColorPickerSetColor(colour);
80
      },
81
      onSubmit: function(_hsb, hex, _rgb, _el) {
0 ignored issues
show
Unused Code introduced by
The parameter _el is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter _rgb is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
82
        $.post($("#coloring-path-darken").val(), {color: '#' + hex}).done(function(data) {
0 ignored issues
show
Unused Code introduced by
The parameter data is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
83
          location.reload()
84
        });
85
      },
86
    });
87
  }
88
89
  // Only run on the admins edit user page.
90
  if (controller == "admins" && action == "edit_user") {
91
    $(".setting-btn").click(function(data){
92
      var url = $("body").data("relative-root")
93
      if (!url.endsWith("/")) {
94
        url += "/"
95
      }
96
      url += "admins?setting=" + data.target.id
97
98
      window.location.href = url
99
    })
100
  }
101
});
102
103
// Change the branding image to the image provided
104
function changeBrandingImage(path) {
105
  var url = $("#branding-url").val()
106
  $.post(path, {url: url})
107
}
108
109
// Filters by role
110
function filterRole(role) {
111
  search = new URL(location.href).searchParams.get('search')
0 ignored issues
show
Bug introduced by
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable search seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.search.
Loading history...
112
113
  url = window.location.pathname + "?page=1" + "&role=" + role
0 ignored issues
show
Bug introduced by
The variable url seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.url.
Loading history...
114
115
  if (search) {
116
    url += "&search=" + search
117
  }  
118
119
  window.location.replace(url);
120
}
121
122
function rgb2hex(rgb) {
123
  rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
124
  function hex(x) {
125
      return ("0" + parseInt(x).toString(16)).slice(-2);
126
  }
127
  return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
128
}
129
130